<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>for循环介绍和应用</title>
    
</head>
<body>
    <script type="text/javascript">
        var arr = [1, 2, 3, 4]
        // 循环 for 循环
        // for(初始化条件;结束的条件;递增条件){
        //     // run this code
        // }
        var i;
        var sum = 0;
        for(i=1;i<=100;i++){
            sum += i;
        }
        console.log(sum)

        for(i=0;i<arr.length;i++){
            console.log(i, arr[i])
            var htmlStr = '<h1>' + i + ':' + arr[i] + '</h1>'
            document.write(htmlStr)
            console.log(htmlStr)
        }
    </script>
</body>
</html>